import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;

import org.omg.CORBA.portable.UnknownException;


public class Client
{
	public static void main(String[] args)
	{
		BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in));
		String msg = "Hello";
		while (true)
		{
			try
			{	
				msg = br1.readLine();
				Socket s = new Socket("130.132.135.112", 1337);
				BufferedReader br2 = new BufferedReader(new InputStreamReader(s.getInputStream()));
				BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(s.getOutputStream()));

				bw.write(msg + "\n");
				bw.write("END\n");
				bw.flush();

				String in = br2.readLine();
				String total = "";

				while(in != null)
				{
					total += in;
					in = br2.readLine();
				}
				br2.close();
				s.close();
				bw.close();
				System.out.println(total);
			}
			catch (UnknownException e)
			{
				System.out.println(e.getMessage());;
			}
			catch (IOException e)
			{
				System.out.println(e.getMessage());
			}
		}
	}
}
